package com.fyzk.activity.prize.item;

import android.view.View;
import android.widget.LinearLayout;

import com.fyzk.activity.lottery.shuzicai.klpk.KLPKPrizeTools;
import com.fyzk.data.AppLotteryInfos;
import com.fyzk.utils.LotteryIDUtils;
import com.tyjc.lottery.R;

import java.util.ArrayList;
import java.util.List;

public class KLPKPrizeItem extends PL3PrizeItem implements
		PrizeNumFormatInterface {

	@Override
	public String getLotteryName() {
		return AppLotteryInfos.getLotteryName(LotteryIDUtils.KLPK_LOTTERY_ID_INT);
	}

	@Override
	public int getLogoResID() {
		return R.drawable.main_klpk;
	}

	@Override
	public void initNumView(View view) {
		LinearLayout layout = (LinearLayout) view;
		layout.removeAllViews();
		String prizeNum = this.getPrizeNum();
		String[] nums = prizeNum.split(",");
		List<Integer> codes = new ArrayList<>();
		int arr_length = nums.length;
		for (int i = 0; i < arr_length; i++) {
			
			int num = 1;
			try{
				num = Integer.parseInt(nums[i].trim());
			}catch(Exception e){
				num = 1;
			}
			codes.add(num);
		}
		layout.addView(KLPKPrizeTools.getNumView(codes));
	}

}
